package mao.thinkinjava.concurency.proxy;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;
public class DynamicProxy implements InvocationHandler {
    Object proxied = null;
    public DynamicProxy(Object proxied){
        this.proxied = proxied;
    }

    @Override
    public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
        System.out.println(proxy.getClass().getSimpleName());
        Object res = method.invoke(proxied,args);
       // method.invoke(proxy,args);
        System.out.println("do some thing after call the proxied object");
        return res;
    }
}
